package fun.pengzh.demo.kafka.sample1;

import fun.pengzh.demo.kafka.pojo.Foo1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author pengzh
 * @class Controller
 * @since 2021-09-14
 */
@RestController
public class Controller {

    @Autowired
    private KafkaTemplate<Object, Object> template;

    @PostMapping(path = "/send/foo/{what}")
    public void sendFoo(@PathVariable String what) {
        this.template.send("topic1", new Foo1(what));
    }
//    @PostMapping(path = "/send/dlt/{what}")
//    public void sendDlt(@PathVariable String what) {
//        this.template.send("topic1.DLT", new Foo1(what));
//    }


}
